// eslint-disable-next-line
import { UserLayout, BasicLayout, BlankLayout } from '@/layouts'

const RouteView = {
  name: 'RouteView',
  render: h => h('router-view')
}

export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: '首页' },
    redirect: '/dashboard/analysis',
    children: [
      // 控制面板
      {
        path: 'dashboard/analysis',
        name: 'analysis',
        // redirect: '/dashboard/analysis',
        hideChildrenInMenu: true,
        component: () => import('@/views/dashboard/Analysis'),
        meta: { title: '控制面板', icon: 'dashboard', keepAlive: true, permission: ['dashboard-Analysis'] }
        // children: [
        //   {
        //     path: '/dashboard/analysis',
        //     name: 'Analysis',
        //     component: () => import('@/views/dashboard/Analysis'),
        //     meta: { title: '个人中心', icon: 'fund', keepAlive: false, permission: [ 'dashboard-Analysis' ] }
        //   }
        // ]
      },

      // 系统信息
      {
        path: '/system',
        name: 'system',
        component: RouteView,
        redirect: '/system/school',
        meta: { title: '基础信息', icon: 'setting', permission: ['system'] },
        children: [
          {
            path: '/system/role',
            name: 'role',
            hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
            component: () => import('@/views/system/RoleList'),
            meta: { title: '角色管理', icon: 'idcard', keepAlive: true, permission: ['system-Role'] }
          }
        ]
      },
      {
        path: '/member',
        name: 'member',
        component: RouteView,
        redirect: '/member/user',
        meta: { title: '人员管理', icon: 'appstore', permission: ['member'] },
        children: [
          // {
          //   path: '/member/teacher',
          //   name: 'memberTeacher',
          //   hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
          //   component: () => import('@/views/basic/TeacherList'),
          //   meta: { title: '教师管理', icon: 'contacts', keepAlive: true, permission: ['member-Teacher'] }
          // },
          {
            path: '/member/user',
            name: 'memberUser',
            hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
            component: () => import('@/views/basic/UserList'),
            meta: { title: '用户管理', icon: 'smile', keepAlive: true, permission: ['member-User'] }
          }
        ]
      },

      // 基本功能
      {
        path: '/hot',
        name: 'hot',
        component: RouteView,
        redirect: '/hot',
        meta: { title: '热搜信息', icon: 'appstore', permission: ['hot'] },
        children: [
          {
            path: '/hot/know',
            name: 'know',
            hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
            component: () => import('@/views/hot/HotZhBasic'),
            meta: { title: '知乎热搜', icon: 'read', keepAlive: true, permission: ['hot-Know'] }
          },
          {
            path: '/hot/wb',
            name: 'wb',
            hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
            component: () => import('@/views/hot/HotWbBasic'),
            meta: { title: '微博热搜', icon: 'read', keepAlive: true, permission: ['hot-Wb'] }
          },
          {
            path: '/hot/ZhAnswer',
            name: 'knowAnswer',
            hidden: true,
            hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
            component: () => import('@/views/hot/modules/Zh/HotZhAnswer'),
            meta: { title: '热搜回答', icon: 'read', keepAlive: false, permission: ['hot-Know-Answer'] }
          },
        ]
      }
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      },
      {
        path: 'register',
        name: 'register',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Register')
      },
      {
        path: 'register-result',
        name: 'registerResult',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/RegisterResult')
      },
      {
        path: 'recover',
        name: 'recover',
        component: undefined
      }
    ]
  },

  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }
]
